package com.lanou.wuyou.gift.gift;

import android.graphics.Color;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;

import com.lanou.wuyou.gift.R;
import com.lanou.wuyou.gift.base.BaseFragment;

import java.util.List;

/**
 * Created by dllo on 17/3/17.
 */

public class GiftFragment extends BaseFragment{
    private ViewPager viewPager;
    private TabLayout tabLayout;
    private GiftVPAdapter adapter;
    private List<Fragment> fragments;
    private String[] titles = {"推荐","纪念日","生日","结婚","商务","乔迁"};
    public static GiftFragment newInstance(){
        Bundle args = new Bundle();
        GiftFragment giftFragment = new GiftFragment();
        giftFragment.setArguments(args);
        return giftFragment;
    }
    @Override
    public int setLayout() {
        return R.layout.fragment_gift;
    }

    @Override
    public void initView(View view) {
        viewPager = (ViewPager) view.findViewById(R.id.view_pager_gift);
        tabLayout = (TabLayout) view.findViewById(R.id.tab_layout_gift);
        adapter = new GiftVPAdapter(getChildFragmentManager());
        viewPager.setAdapter(adapter);
        tabLayout.setupWithViewPager(viewPager);
        tabLayout.setTabTextColors(Color.parseColor("#949494"),Color.parseColor("#e63b4b"));
        tabLayout.setBackgroundColor(Color.WHITE);
        tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);

        for (int i = 0; i < titles.length; i++) {
//            fragments.add()
        }
        for (int i = 0; i < titles.length; i++) {
            tabLayout.getTabAt(i).setText(titles[i]);
        }
    }

    @Override
    public void initData() {

    }
}
